package com.ms.service.controller;

import com.ms.service.entity.User;
import com.ms.service.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping(name = "login",value="/login", method = RequestMethod.POST)
    public User login(@RequestBody User user){
        return userService.getUser(user);
    }
    @RequestMapping(name = "register",value="/register", method = RequestMethod.POST)
    public boolean getProduct(@RequestBody User user){
        return userService.insertUser(user);
    }
}
